const mock = require('./src/mock/index')
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  // lintOnSave: false,
  devServer: {
    proxy: {
      '/api': {
        target: 'http://sph-h5-api.atguigu.cn',
      },
    },
    port: '8081',
    onBeforeSetupMiddleware(devServer) {
      const app = devServer.app
      mock(app)
      /* //一般写法 
      app.get('/mock/home/swiper', (req, res) => {
        res.json({
          code: 200,
          message: '成功',
          data: [
            {
              id: 1,
              message: 'hello',
            },
          ],
        })
      }) */
    },
  },
})
